<template>
  <div id="app">

    <router-view/>
  </div>
</template>

<script>

export default {
  destroyed() {//销毁组件时，移除监听事件
    window.addEventListener('beforeunload', this.closeWindow)//监听关闭窗口事件
  },
  methods: {
    // 关闭窗口
    closeWindow() {
      sessionStorage.clear();
      localStorage.clear();//清除所有缓存
      localStorage.removeItem('token');//退出清除token
      return false;
    }
  }
}
</script>



<style lang="less">
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
}

nav {
  padding: 30px;

  a {
    font-weight: bold;
    color: #2c3e50;

    &.router-link-exact-active {
      color: #42b983;
    }
  }
}
</style>
